package com.start.common.jackson;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.JsonStreamContext;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.start.common.enums.StartBaseStringEnum;
import org.apache.commons.lang3.StringUtils;

import java.io.IOException;

public class StartEnumStringDeserializer extends JsonDeserializer<StartBaseStringEnum> {
    @Override
    public StartBaseStringEnum deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
        String value = jsonParser.getValueAsString();
        if (StringUtils.isEmpty(value)) return null;
        JsonStreamContext parent = jsonParser.getParsingContext().getParent();
        Object currentValue = parent.getCurrentValue();
        
        return null;
    }
}
